local total = redis.call('GET', KEYS[1])
local count = redis.call('GET', KEYS[2])
local result = 0
if count < total then
	result = 1
	count = count + 1
	redis.call('SET', KEYS[2], count)
else
	result = 0
end
return result